package com.holyant.goods.dto;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.domain.BaseDto;
import com.holyant.goods.enums.SpecsQtyEnum;
import com.holyant.goods.utils.ExtAttrUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * 商品SKUdto
 *
 * @author tswsoft
 * @date 2021-04-06
 */
@Data
@ApiModel("商品SKUCost")
public class GdsSkuCostDto extends BaseDto {

    private static final long serialVersionUID = 1L;

    /** sku编号 */
    @Excel(name = "sku编码")
    @ApiModelProperty(value = "sku编号")
    private String code;

    /** sku名称 */
    @Excel(name = "sku名称")
    @ApiModelProperty(value = "sku名称")
    private String name;

    /**
     * 所属商品编码
     */
    private Long goodsId;

    /** 商品编码 */
    @ApiModelProperty(value = "商品编码")
    private String goodsCode;

    /** 商品名称 */
    @Excel(name = "商品名称")
    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    /** 商品条码 */
    @Excel(name = "商品条码")
    @ApiModelProperty(value = "商品条码")
    private String goodsBarcode;

    private String goodsSpecsUnit;
    /** 商品扩展属性 */
    private String goodsExtAttr;

    /** HsCode */
    @ApiModelProperty(value = "HsCode")
    private String hsCode;

    /** 所属分类id */
    @ApiModelProperty(value = "所属分类id")
    private Long categoryId;

    /** 所属分类名称 */
    @ApiModelProperty(value = "所属分类名称")
    private String categoryName;

    /** 所属分类编码 */
    @ApiModelProperty(value = "所属分类编码")
    private String categoryCode;

    /** 可用库存 */
    @Excel(name = "可用库存")
    @ApiModelProperty(value = "可用库存")
    private BigDecimal availableQty;

    /** 品牌id */
    @ApiModelProperty(value = "品牌id")
    private Long brandId;

    /** 品牌名称 */
    @ApiModelProperty(value = "品牌名称")
    private String brandName;

    /** 计量单位id */
    @ApiModelProperty(value = "计量单位id")
    private Long unitId;

    /** 计量单位名称 */
    @ApiModelProperty(value = "计量单位名称")
    private String unitName;

    /** 状态  0 正常 1 停用 */
    @ApiModelProperty(value = "状态  0 正常 1 停用")
    private String status;

    /** 采购价 */
    @ApiModelProperty(value = "采购价")
    private BigDecimal purPrc;

    /** 销售价 */
    @ApiModelProperty(value = "销售价")
    private BigDecimal salesPrc;

    /** 保质期(月) */
    @ApiModelProperty(value = "保质期(月)")
    private Integer qualityPeriod;

    /** 失效日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "失效日期")
    private LocalDate expireDate;

    /** 毛重 */
    @ApiModelProperty(value = "毛重")
    private BigDecimal grossWeight;

    /** 净重 */
    @ApiModelProperty(value = "净重")
    private BigDecimal netWeight;

    /** 体积 */
    @ApiModelProperty(value = "体积")
    private BigDecimal volume;

    /**
     * 箱规
     */
    @ApiModelProperty(value = "箱规")
    private String boxSpec;

    /**
     * 托规
     */
    @ApiModelProperty(value = "托规")
    private String palletSpec;

    /** 规格 */
    @ApiModelProperty(value = "规格")
    private String specs;

    /** 发货方式 10-保税区发货 20-香港直邮 30-海外直邮 100-国内发货 */
    @ApiModelProperty(value = "发货方式 10-保税区发货 20-香港直邮 30-海外直邮 100-国内发货")
    private Integer deliveryType;

    /** 原产国 */
    @ApiModelProperty(value = "原产国")
    private String originCountry;

    /** 扩展属性 */
    private String extAttr;

    @ApiModelProperty(value = "扩展属性")
    private String extAttrDisplay;

    /** 是否上架 1 是 0 否 */
    @ApiModelProperty(value = "是否上架 1 是 0 否")
    private String shelfFlag;

    /** 成本价不含税 */
    @ApiModelProperty(value = "成本价不含税")
    private String costPriceObj;

    /** 成本价含税 */
    @ApiModelProperty(value = "成本价含税")
    private String taxCostPriceObj;

    /** 1pcs指引价格 */
    @Excel(name = "包邮包税1pcs价格")
    @ApiModelProperty(value = "包邮包税1pcs价格")
    private BigDecimal taxCostPrice1;

    /** 2pcs指引价格 */
    @Excel(name = "包邮包税2pcs价格")
    @ApiModelProperty(value = "包邮包税2pcs价格")
    private BigDecimal taxCostPrice2;

    /** 3pcs指引价格 */
    @Excel(name = "包邮包税3pcs价格")
    @ApiModelProperty(value = "包邮包税3pcs价格")
    private BigDecimal taxCostPrice3;

    /** 4pcs指引价格 */
    @Excel(name = "包邮包税4pcs价格")
    @ApiModelProperty(value = "包邮包税4pcs价格")
    private BigDecimal taxCostPrice4;

    /** 5pcs指引价格 */
    @Excel(name = "包邮包税5pcs价格")
    @ApiModelProperty(value = "包邮包税5pcs价格")
    private BigDecimal taxCostPrice5;

    /** 6pcs指引价格 */
    @Excel(name = "包邮包税6pcs价格")
    @ApiModelProperty(value = "包邮包税6pcs价格")
    private BigDecimal taxCostPrice6;

    /** 1pcs指引价格 */
    @Excel(name = "包邮不包税1pcs价格")
    @ApiModelProperty(value = "包邮不包税1pcs价格")
    private BigDecimal costPrice1;

    /** 2pcs指引价格 */
    @Excel(name = "2pcs成本价格")
    @ApiModelProperty(value = "包邮不包税2pcs价格")
    private BigDecimal costPrice2;

    /** 3pcs指引价格 */
    @Excel(name = "3pcs成本价格")
    @ApiModelProperty(value = "包邮不包税3pcs价格")
    private BigDecimal costPrice3;

    /** 4pcs指引价格 */
    @Excel(name = "包邮不包税4pcs价格")
    @ApiModelProperty(value = "包邮不包税4pcs价格")
    private BigDecimal costPrice4;

    /** 5pcs指引价格 */
    @Excel(name = "包邮不包税5pcs价格")
    @ApiModelProperty(value = "包邮不包税5pcs价格")
    private BigDecimal costPrice5;

    /** 6pcs指引价格 */
    @Excel(name = "包邮不包税6pcs价格")
    @ApiModelProperty(value = "包邮不包税6pcs价格")
    private BigDecimal costPrice6;

    /** 备注 */
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remark;

    public String getExtAttrDisplay() {
        return ExtAttrUtils.getExtAttrDisplay(this.extAttr);
    }

    public JSONObject getCostPriceObjJson() {
        return JSON.parseObject(this.costPriceObj);
    }

    public JSONObject getTaxCostPriceObjJson() {
        return JSON.parseObject(this.taxCostPriceObj);
    }

    public BigDecimal getCostPrice1() {
        return getCostPriceObjJson().getBigDecimal(SpecsQtyEnum.ONE.name());
    }

    public BigDecimal getCostPrice2() {
        return getCostPriceObjJson().getBigDecimal(SpecsQtyEnum.TWO.name());
    }

    public BigDecimal getCostPrice3() {
        return getCostPriceObjJson().getBigDecimal(SpecsQtyEnum.THREE.name());
    }

    public BigDecimal getCostPrice4() {
        return getCostPriceObjJson().getBigDecimal(SpecsQtyEnum.FOUR.name());
    }

    public BigDecimal getCostPrice5() {
        return getCostPriceObjJson().getBigDecimal(SpecsQtyEnum.FIVE.name());
    }

    public BigDecimal getCostPrice6() {
        return getCostPriceObjJson().getBigDecimal(SpecsQtyEnum.SIX.name());
    }

    public BigDecimal getTaxCostPrice1() {
        return getTaxCostPriceObjJson().getBigDecimal(SpecsQtyEnum.ONE.name());
    }

    public BigDecimal getTaxCostPrice2() {
        return getTaxCostPriceObjJson().getBigDecimal(SpecsQtyEnum.TWO.name());
    }

    public BigDecimal getTaxCostPrice3() {
        return getTaxCostPriceObjJson().getBigDecimal(SpecsQtyEnum.THREE.name());
    }

    public BigDecimal getTaxCostPrice4() {
        return getTaxCostPriceObjJson().getBigDecimal(SpecsQtyEnum.FOUR.name());
    }

    public BigDecimal getTaxCostPrice5() {
        return getTaxCostPriceObjJson().getBigDecimal(SpecsQtyEnum.FIVE.name());
    }

    public BigDecimal getTaxCostPrice6() {
        return getTaxCostPriceObjJson().getBigDecimal(SpecsQtyEnum.SIX.name());
    }
}
